import { ObjectType } from '../types';
import {BaseInsertDto, BaseUpdateDto} from './.dto';

enum OrderStatus {
  PENDING_PAYMENT = '待处理',
  PROCESSING = '处理中',
  COMPLETED = '已完成',
  CANCELLED = '已取消',
}

/** 订单列表DTO */
export class OrderListDto implements ObjectType {
  id: string = '';
  actualAmount: number = 0;
  addressId: string = '';
  orderStatus: OrderStatus = OrderStatus.CANCELLED;
  totalAmount: number = 0;
  userId: string = '';
}

/** 订单单个DTO */
export class OrderSingleDto implements ObjectType {
  id: string = '';
  actualAmount: number = 0;
  addressId: string = '';
  orderStatus: OrderStatus = OrderStatus.CANCELLED;
  totalAmount: number = 0;
  userId: string = '';
}

/** 订单创建DTO */
export class OrderCreateDto extends BaseInsertDto {
  actualAmount: number = 0;
  addressId: string = '';
  items: any[] = [];
  paymentMethod: string = '';
  totalAmount: number = 0;
  userId: string = '';
}

/** 订单更新DTO */
export class OrderUpdateDto extends BaseUpdateDto {
  actualAmount: number = 0;
  addressId: string = '';
  items: any[] = [];
  paymentMethod: string = '';
  totalAmount: number = 0;
  userId: string = '';
}

/**
 * @swagger
 * components:
 *   schemas:
 *     OrderListDto:
 *       type: object
 *       properties:
 *         id:
 *           type: integer
 *           description: 订单的唯一标识符
 *           example: 1
 *         actualAmount:
 *           type: number
 *           description: 实际支付金额，用户最终支付的金额
 *           example: 99.99
 *         addressId:
 *           type: integer
 *           description: 收货地址ID，指向用户选择的地址
 *           example: 1
 *         orderStatus:
 *           type: string
 *           description: 订单状态，表示订单的当前状态
 *           example: 'PENDING_PAYMENT'
 *         totalAmount:
 *           type: number
 *           description: 订单总金额，用户下单时的总金额
 *           example: 100.00
 *         userId:
 *           type: integer
 *           description: 下单用户ID，指向下单用户的唯一标识符
 *           example: 1
 *     OrderSingleDto:
 *       allOf:
 *         - $ref: '#/components/schemas/OrderListDto'
 *     OrderCreateDto:
 *       type: object
 *       properties:
 *         actualAmount:
 *           type: number
 *           description: 实际支付金额，用户最终支付的金额
 *           example: 99.99
 *         addressId:
 *           type: integer
 *           description: 收货地址ID，指向用户选择的地址
 *           example: 1
 *         items:
 *           type: array
 *           items:
 *             $ref: '#/components/schemas/OrderItem'
 *           description: 订单项列表，包含用户购买的商品信息
 *         paymentMethod:
 *           type: string
 *           description: 支付方式，用户选择的支付方式
 *           example: 'CREDIT_CARD'
 *         totalAmount:
 *           type: number
 *           description: 订单总金额，用户下单时的总金额
 *           example: 100.00
 *         userId:
 *           type: integer
 *           description: 下单用户ID，指向下单用户的唯一标识符
 *           example: 1
 *     OrderUpdateDto:
 *       type: object
 *       properties:
 *         actualAmount:
 *           type: number
 *           description: 实际支付金额，用户最终支付的金额
 *           example: 99.99
 *         addressId:
 *           type: integer
 *           description: 收货地址ID，指向用户选择的地址
 *           example: 1
 *         items:
 *           type: array
 *           items:
 *             $ref: '#/components/schemas/OrderItem'
 *           description: 订单项列表，包含用户购买的商品信息
 *         paymentMethod:
 *           type: string
 *           description: 支付方式，用户选择的支付方式
 *           example: 'CREDIT_CARD'
 *         totalAmount:
 *           type: number
 *           description: 订单总金额，用户下单时的总金额
 *           example: 100.00
 *         userId:
 *           type: integer
 *           description: 下单用户ID，指向下单用户的唯一标识符
 *           example: 1
 */
